package kr.hkit.powerjava.chapter07;

public class Eworld {
	private int gubun; //자유이용권 1, 입장권 0
	private int age;	//나이
	private int hour; 	//입장 시간
	
	public Eworld(int gubun, int age, int hour) {
		this.gubun = gubun;
		this.age = age;
		this.hour = hour;
	}
	public void setData(int gubun, int age, int hour){
		this.gubun = gubun;
		this.age = age;
		this.hour = hour;
	}
	public int getPrice(){
		int price =0;	
		if(gubun == 1){
			if(hour < 17){
				if(age < 3){
					price = 0;
				}
				else{
					if((age<13 || age>65)){
					price = 25000;
					}
					else{
					price = 34000;
					}
				}
			}
			else{
				if(age<3){
					price = 0;
				}
				else{
					if((age<13 || age>65)){
					price = 21000;
					}
					else{
					price = 29000;
					}
				}
			}	
			
		}
		else
			if(hour < 17){
				if(age<3){
					price = 0;
				}
				else{
					if((age<13 || age>65)){
					price = 20000;
					}
					else{
					price = 27000;
					}
				}
			}
			else{
				if(age<3){
					price = 0;
				}
				else{
					if((age<13 || age>65)){
						price = 17000;
					}
					else{
						price = 23000;
					}
				}
			}
		return price;
		
	}

	@Override
	public String toString() {
		return "Eworld [gubun=" + gubun + ", age=" + age + ", hour=" + hour
				+ ", getPrice()=" + getPrice() + "]";
	}
	
	
}
